home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 018a / amac41.zip / COM001.QM < prev    next >
Text File  |  1991-08-26  |  37KB  |  744 lines

  1. *                               COM001.QM
  2. *                        Written By Tom Hogshead
  3. *                       [ See COMTxx.QM For Use ]
  4. *                                 8/8/91
  5. *  Key    Subfile              Description
  6. * =====  =========  =====================================================
  7. * ^(cursordown)
  8. *                 --Comment Or Un-Comment Line Or Block With * In Col 1,
  9. *                   Blank Lines NOT Commented,
  10. *                   Pauses To Mark Block If Not Marked
  11. *                            (John Goodman And Tom Hogshead, Authors)
  12. * @(3)            --Comment Or Un-Comment Line Or Block With * In Col 1,
  13. *                   Blank Lines NOT Commented
  14. *                            (John Goodman And Tom Hogshead, Authors)
  15. * @(8)            --Comment Or Un-Comment Line Or Block With * In Col 1,
  16. *                   Blank Lines Are Commented,
  17. *                            (John Goodman And Tom Hogshead, Authors)
  18. * @(2)            --Comment Or Un-comment With "*»" In Col 1,
  19. *                   Blank Lines NOT Commented,
  20. *»                  (like this)
  21. * @(1)            --Add/Delete '*-- ' In Front Of Commenting Line,
  22. *--                 (like this)
  23. * @(4)            --Center Macro Comment * -- <Comment> --*
  24. * @(7)            --Remove Macro Comment * -- <Comment> --*
  25. * @(F1)           --Comment Non-macro Portion Of File
  26. * ^(F1_)          --Un-comment Non-macro Portion Of File
  27. * @(F5)           --Original Commenting Macro     (John Goodman, Author)
  28. * @(5)            --Original Un-commenting Macro  (John Goodman, Author)
  29. * #(F5__)         --Revised Original Goodman Un-commenting,
  30. *                   Checks Before Un-commenting
  31. * @(F2)           --Comment Paragraph Or Block
  32. * #(F2__)         --Builds A "Comment Box" For C Programmers
  33. *                      (Tim Farley, Author)
  34. * @(F3)           --Comment Whole File
  35. * ^(F3_)          --Un-comment Whole File
  36. * #(F3__)         --Center C Program Comment  (Richard Blackburn, Author)
  37. *
  38. *         {e:\up\COMT*}--Return To COMTxx.QM
  39. *
  40. *-- eoi
  41.  
  42.  
  43. * 
  44. * -------------------------------------------------------------------
  45. * ^(cursordown) Comment or un-comment line or block with <* comment>,
  46. *               Blank Lines NOT Commented,
  47. *               Pauses To Mark Block If Not Marked
  48. *               (Tom Hogshead and John Goodman authors)
  49. * -------------------------------------------------------------------
  50.  
  51. * This macro performs the same commenting or uncommenting functions as
  52. * @8 (commenting macro written by John Goodman and me) except this
  53. * version does *not* comment blank lines and pauses to allow the user
  54. * to select lines to be commented or uncommented if they are not
  55. * already marked. Blocks do not have to be marked before executing
  56. * macro, and may be a line, character or column block, open or closed.
  57. * Blank lines are not commented, but can be by changing ASCII #32 to
  58. * any other ASCII character. This macro will fit on one line of QConfig
  59. * by changing "Label" to "L" in the QMAC compiled txtfile as shown at
  60. * the end of this macro.
  61.  
  62. ^CursorDown MacroBegin
  63.         CursorRight             * Needed for single line blocks
  64.         GotoBlockBeg            * Try going to block begin
  65.         JTrue A:                * True only if both ends marked       |
  66.         MarkLine                * Set line block marker               |
  67.         GotoBlockBeg            * Try going to block begin again      |
  68.         JTrue OK:               * True if one end was marked          |
  69.         Pause                   * Nothing marked, let user mark it    |
  70.         Jump B:                 * Jump to finish block                |f
  71.  A:                             * Here if both ends originally marked |
  72.         GotoBlockEnd            * Go to end of block                  |
  73.         UnmarkBlock             * Remove block completely             |
  74.         MarkLine                * Start Line block                    |
  75.         PrevPosition            * Return to original begin of block   |
  76.  B:                             *                                     |
  77.         MarkLine                * Finish marking block                |
  78.         GotoBlockBeg            * Make sure we're at the beginning    |
  79.  OK:                            * Now have completed line block       |
  80. * ----------------- Check If Block Already Commented ----------------*
  81.         BegLine                 * Go to col 1                         |f
  82.         CursorRight             * Position cursor for find
  83.         Find "*" Return         * Test if line is already commented
  84.         "LB" Return             *(assumes all block commented or not)
  85.         Jfalse COMMENT:         * If no star in col 1, must comment
  86. * ------------------------  Uncomment Block -------------------------*
  87.  UNCOMMENT:                     *ELSE
  88.         ShiftLeft ShiftLeft     * Col 1 has star, uncomment block
  89.         Jump END:               * End macro
  90. * -------------------------- Comment Block --------------------------*
  91.  COMMENT:
  92.         ShiftRight ShiftRight   * Shift all lines right twice
  93.         BegLine                 * Move cursor to col 1
  94.         GotoBlockEnd            * Move to 1st char of last line
  95.         MarkColumn              * Mark 1st char, column block
  96.         PrevPosition            * Return to block begin col 2
  97.         begline                 * Needed for single-line case
  98.         markcolumn              * Close column block to go to at end
  99.         FillBlock               * FillBlock
  100.             #32  Return         * with space #32 (Change #32 to any ASCII
  101.                                 *       character to comment blank lines)
  102.         FindReplace             * Replace
  103.             #32  Return         * space
  104.             "*"  Return         * with "*"
  105.             "LN" Return         * Local, No Prompt Replace
  106.  END:                           *
  107.         GoToBlockEnd            * Move to end of block
  108.         begline                 *
  109.         UnmarkBlock             * Unmark the block
  110.         CursorDown              * Go to next line
  111. *
  112. * 46 bytes Sun  03-31-1991  01:51:24 (TH/JG @8)
  113. * 58 bytes Tue  04-30-1991  19:06:16 (TH/JG @3 not comment blank lines)
  114. * 66 bytes Mon  05-27-1991  18:55:32 (TH sent to JG as @7                 |a)
  115. * 65 bytes Tue  07-09-1991  14:49:01 (TH ^cursordown, line blocks only,   |b)
  116. * 78 bytes Tue  07-09-1991  15:09:58 (TH ^cursordown, col/char blocks OK, |c)
  117. * 74 bytes Tue  07-09-1991  23:15:04 (TH ^cursordown, shortened/sent to JG|d)
  118. * 74 bytes Thu  07-11-1991  23:09:20 (TH ^CursorDown, moved begline up    |e)
  119. * 71 bytes Tue  07-23-1991  20:49:09 (JG @1, Replaced all above OK: label |f)
  120. * 71 bytes Tue  07-23-1991  20:49:09 (JG/TH ^cursordown, shortened        |f)
  121.  
  122.  
  123. *  QConfig Version of ^CursorDown Above
  124. *  -------------------------------------
  125. * Changing "Label" to "L" the following QMAC compiled version of
  126. * ^cursordown will fit on one line of QConfig.dat using 479 of 512
  127. * characters:
  128.  
  129. * ^cursordown MacroBegin CursorRight GotoBlockBeg JTrue L0: MarkLine
  130. *     GotoBlockBeg JTrue L1: Pause Jump L2: L0: GotoBlockEnd
  131. *     UnmarkBlock MarkLine PrevPosition L2: MarkLine GotoBlockBeg L1:
  132. *     BegLine CursorRight Find "*" Return "LB" Return JFalse L3:
  133. *     ShiftLeft ShiftLeft Jump L4: L3: ShiftRight ShiftRight BegLine
  134. *     GotoBlockEnd MarkColumn PrevPosition BegLine MarkColumn FillBlock
  135. *     " " Return FindReplace " " Return "*" Return "LN" Return L4:
  136. *     GotoBlockEnd BegLine UnmarkBlock CursorDown
  137. * *
  138. * * 71 bytes Tue  07-23-1991  20:49:09 (JG/TH ^cursordown)
  139.  
  140. * 
  141. * -------------------------------------------------------------------
  142. * @(3) Comment or un-comment <* comment>, Blank lines *not* commented
  143. *     (Tom Hogshead and John Goodman authors)
  144. * -------------------------------------------------------------------
  145.  
  146. * Does *not* comment blank lines. Change #32 to any ASCII character
  147. * to comment blank lines. This is an alternate version of @8.
  148.  
  149. @3      MacroBegin
  150. * ------- Check and finish marking line or block if not marked -------*
  151.         CursorRight           * Needed for single-line blocks
  152.         GotoBlockBeg          * Try going to block beg, retain pos.
  153.    JTrue BLK:                 * Determine if a completed block
  154.         DropAnchor            * If not, DropAnchor will finish it
  155.                               * or mark current line if none started
  156.         GotoBlockBeg          * Go to block beg to retain position
  157.    BLK: GotoBlockEnd          * Start at the end
  158.         MarkLine              * Mark line to close block
  159.         PrevPosition          * Return to block begin
  160. * ----------------- Check if block already commented -----------------*
  161.         BegLine               * Go to bol in case line block
  162.         CursorRight           * Move to column 2
  163.         Find "*" Return       * See if line is already commented
  164.         "LB" Return           *(assumes all block commented or not)
  165.         Jfalse COMMENT:       * If no star in col 1, must comment
  166. * ------------------------  un-comment block ------------------------*
  167.  UNCOMMENT:                   *ELSE
  168.         ShiftLeft ShiftLeft   * Col 1 has star, un-comment block
  169.         Jump END:             * Go to end macro
  170. * -------------------------- Comment block --------------------------*
  171.  COMMENT:   
  172.         ShiftRight ShiftRight * Shift all lines to right twice
  173.         BegLine               * Move cursor to column 1
  174.         GotoBlockEnd          * Move to 1st char of last line
  175.         MarkColumn            * Mark 1st character column
  176.         PrevPosition          * Return to first line
  177.         BegLine               * Needed for single-line blocks
  178. *       FillBlock '*' Return  * Fill 1st column with '*'
  179.         FillBlock             * FillBlock
  180.         #32 Return            * with space  (Change #32 to any ASCII
  181.                               *  character to comment blank lines)
  182.         FindReplace           * Replace
  183.         #32  Return           * space
  184.         "*" Return            * with "*"
  185.         "LN" Return           * Local, No Prompt Replace
  186.  END:                         *
  187.         UnmarkBlock           * Unmark the block
  188.         CursorDown            * Go to next line
  189. *
  190. * 46 bytes Sun  03-31-1991  01:51:24 (JG/TH @8)
  191. * 58 bytes Tue  04-30-1991  19:06:16 (TH/JG @3, not comment blank lines)
  192.  
  193. * 
  194. * ----------------------------------------------------------------------
  195. * @(4) Center macro comment <* -- comment --*>
  196. * ----------------------------------------------------------------------
  197. *
  198. * I have modified #F3, written by Richard Blackburn of SemWare at the
  199. * request of Bob Denhnhardt to comment c programs, to make and center
  200. * macro comment lines. Type comment beginning in column 1. Press @4 to
  201. * make it a comment line highlighted with dashes. This line was made
  202. * typing "start", then @4:
  203. *
  204. * ------------------------------ start ------------------------------*
  205. *
  206. @4      MacroBegin                  *  Start Macro
  207.         UnMarkBlock                 *  make sure no blocks marked
  208. * ---------------------------- set margin ----------------------------*
  209.         SetRmargin "72" Return      ** set right margin to 72
  210. * -------------------------- center comment --------------------------*
  211.         BegLine                     *  goto start of line
  212.         DropAnchor                  *  ---
  213.         DropAnchor                  *  --- to save our place
  214.         CenterLine                  *  center the line
  215. * -------------------------- complete line --------------------------*
  216.         GotoBlockBeg                *  goto begin of block
  217.         UnMarkBlock                 *  un mark it
  218.         CursorLeft                  *  cursor left twice
  219.         CursorLeft                  *
  220.         JFalse END                  *  if not goto end line to long
  221.         MarkColumn                  *  mark column
  222.         BegLine                     *  goto beginning of line
  223.         DelCh                       *  delete char incase in insert mode
  224.         DelCh                       ** delete char incase in insert mode
  225.         "* "                        ** put a "*_space"  at start
  226.         MarkColumn                  *  mark the column
  227.         FillBlock "-" Return        ** fill with -
  228.         Copy                        *  copy to scrap buffer
  229.         EndLine                     *  goto end of line
  230.         CursorRight                 *  space over one
  231.         Paste  EndLine "*"          ** paste * at eol
  232. * ------------------------ move to next line ------------------------*
  233.  END:   BegLine                     *  goto start of comment line
  234.         UnMarkBlock                 *  un mark it
  235.         CursorDown                  ** and move down to next line
  236. *
  237. * 45 bytes Fri  03-29-1991  09:30:22
  238.  
  239. * 
  240. * -------------------------------------------------------------------
  241. * @(8) Comment or un-comment line or block with <* comment> in col 1,
  242. *      John Goodman and Tom Hogshead, authors
  243. * -------------------------------------------------------------------
  244.  
  245. * This macro will add (or delete) comments in front of dBase lines or
  246. * any text or macfile lines that are either a single unmarked line, a
  247. * character, column, or line block that has been opened and/or opened
  248. * and closed by adding (or deleting) an asterisk and single space in
  249. * column 1. Blank lines are commented.
  250.  
  251.  
  252. @8      MacroBegin
  253. * ------- Check and finish marking line or block if not marked -------*
  254.         CursorRight           * Needed for single-line blocks
  255.         GotoBlockBeg          * Try going to block beg, retain pos.
  256.    JTrue BLK:                 * Determine if a completed block
  257.         DropAnchor            * If not, DropAnchor will finish it
  258.                               * or mark current line if none started
  259.         GotoBlockBeg          * Go to block beg to retain position
  260.    BLK: GotoBlockEnd          * Start at the end
  261.         MarkLine              * Mark line to close block
  262.         PrevPosition          * Return to block begin
  263. * * ----------------- Check if block already commented -----------------*
  264.         BegLine               * Go to bol in case line block
  265.         CursorRight           * Move to column 2
  266.         Find "*" Return       * See if line is already commented
  267.         "LB" Return           *(assumes all block commented or not)
  268.         Jfalse COMMENT:       * If no star in col 1, must comment
  269. * ------------------------  un-comment block ------------------------*
  270.  UNCOMMENT:                   *ELSE
  271.         ShiftLeft ShiftLeft   * Col 1 has star, un-comment block
  272.         Jump END:             * Go to end macro
  273. * -------------------------- Comment block --------------------------*
  274.  COMMENT:   
  275.         ShiftRight ShiftRight * Shift all lines to right twice
  276.         BegLine               * Move cursor to column 1
  277.         GotoBlockEnd          * Move to 1st char of last line
  278.         MarkColumn            * Mark 1st character column
  279.         PrevPosition          * Return to first line
  280.         BegLine               * Needed for single-line blocks
  281.         FillBlock '*' Return  * Fill 1st column with '*'
  282.  END:                         *
  283.         UnmarkBlock           * Unmark the block
  284.         CursorDown            * Go to next line
  285. * *
  286. * * 46 bytes Sun  03-31-1991  01:51:24 (TH/JG @8)
  287.  
  288. * 
  289. *» -------------------------------------------------------------------
  290. *» @(2) Comment or un-comment <*» comment> (no blank lines), 64 bytes
  291. *» -------------------------------------------------------------------
  292. *» Does *not* comment blank lines.  Change #32 to any ASCII character
  293. *» to comment blank lines. Replace #175 "»" with any character for
  294. *» alternate commenting second characters.
  295.  
  296. @2      MacroBegin
  297. * ------- Check and finish marking line or block if not marked -------*
  298.         CursorRight           * Needed for single-line blocks
  299.         GotoBlockBeg          * Try going to block beg, retain pos.
  300.    JTrue BLK:                 * Determine if a completed block
  301.         DropAnchor            * If not, DropAnchor will finish it
  302.                               * or mark current line if none started
  303.         GotoBlockBeg          * Go to block beg to retain position
  304.    BLK: GotoBlockEnd          * Start at the end
  305.         MarkLine              * Mark line to close block
  306.         PrevPosition          * Return to block begin
  307. * ----------------- Check if block already commented -----------------*
  308.         BegLine               * Go to bol in case line block
  309.         CursorRight CursorRight * Move to column 3
  310.         Find "*" #175 Return  * See if line is already commented
  311.                               * ( replace #175 with any character
  312.                               *   for alternate second character)
  313.         "LB" Return           * (assumes all block commented or not)
  314.         Jfalse COMMENT:       * If no "*»" in col 1, must comment
  315. * ------------------------  un-comment block ------------------------*
  316.  UNCOMMENT:                   *ELSE
  317.         ShiftLeft ShiftLeft   * Col 1 has "*»", remove it
  318.         ShiftLeft             * Get rid of blank space
  319.         Jump END:             * End macro
  320. * -------------------------- Comment block --------------------------*
  321.  COMMENT:
  322.         ShiftRight ShiftRight * Shift all lines to right twice
  323.         BegLine               * Move cursor to column 1
  324.         GotoBlockEnd          * Move to 1st char of last line
  325.         MarkColumn            * Mark 1st character column
  326.         PrevPosition          * Return to first line
  327.         BegLine               * Needed for single-line blocks
  328.         FillBlock             * FillBlock with space #32
  329.         #32  Return           * (Change #32 to any ASCII character
  330.                               *  to comment blank lines)
  331.         FindReplace           * Replace
  332.         #32  Return           *  space
  333.         "*" #175 Return       *  with "*»"
  334.         "LN" Return           *  Local, No Prompt Replace
  335.  END:                         *
  336.         UnmarkBlock           * Unmark the block
  337.         CursorDown            * Go to next line
  338. *
  339. * 64 bytes Tue  04-30-1991  16:33:59
  340.  
  341. * 
  342. * ----------------------------------------------------------------------
  343. * @(1) Add/Delete '*-- ' In Front Of Commenting Line, Like
  344. *-- this
  345. * ----------------------------------------------------------------------
  346.  
  347. *-- Type comment. This macro then does this. If line is already
  348. *-- commented, the macro removes the "star" + "-- ".
  349.  
  350. @1  macrobegin
  351.     unmarkblock                 *
  352.     markline                    *
  353.     begline                     *
  354.     shiftright                  *
  355.     Find "*-" return            * Test if line already commented
  356.     "L" return                  *
  357.     jfalse ADD:                 * If not, we need to add '*-- '
  358.     delch delch delch delch     *ELSE delete 4 commenting characters + space
  359.     shiftleft                   *
  360.     jump END:                   * End macro
  361.  ADD:                           *
  362.     begline                     *
  363.     insertline                  * InsertLine for Insert set ON/OFF
  364.     "*--"                       * Insert commenting characters,
  365.     joinline                    *
  366.  END:                           *
  367.     begline                     * Re-position
  368.     unmarkblock                 *
  369. *
  370. * 39 bytes Sun  06-23-1991  00:43:28 (TH)
  371. *-- test
  372.  
  373. * 
  374. * ----------------------------------------------------------------------
  375. * @(7) Remove macro comment
  376. * ----------------------------------------------------------------------
  377.  
  378. * This macro removes comments made with @4, like <* -- comment --*>
  379. * Comment must not contain "---", and must contain a "* -" in col 1.
  380. * First character in comment must be in defaultwordset, no * @^ etc.
  381. * Insert must be ON.
  382.  
  383. @7      MacroBegin
  384.         UnMarkBlock                     * Unmark
  385.         DefaultWordSet                  * Set default to find first word
  386.         BegLine                         * Move to begin of comment line
  387.         DropAnchor                      * Mark block begin
  388.         WordRight CursorLeft            *ELSE move to space before comment
  389.         DropAnchor                      * Mark block begin
  390.         Find "* -" return "LB" return   * Check if comment centered
  391.         jfalse end:                     * End macro if not centered
  392.         DeleteBlock                     * Delete left "* --.." to comment
  393.         MarkLine                        * MarkLine
  394.         Find "---" Return "L" Return    * Find first dashes to rt of comment |
  395.         jfalse end:                     * If no dashes, end macro
  396.         UnMarkBlock MarkColumn          *ELSE Mark first dash right of comment
  397.         EndLine DeleteBlock             * Delete all right "---*"
  398.  end:
  399.         unmarkblock                     * Unmark if marked
  400.         BegLine                         * Back to comment begin for edit
  401. *
  402. * 47 bytes Wed  04-17-1991  00:28:25
  403. * 49 bytes Tue  08-06-1991  12:41:36 (TH @7, comment cannot have '---')
  404.  
  405. * 
  406. * ----------------------------------------------
  407. * @(F1)  Comment non-macro portion of file
  408. * ----------------------------------------------
  409. *
  410. @F1 MacroBegin
  411.     Begfile InsertLine                  * Insert temp line in case macro
  412.  START:                                 * starts on line 1
  413.     MarkLine                            *
  414.     Find " " "macrob" Return "I" Return * Find start of macro
  415.     Jtrue HAS_MACROB:                   * If this para is a macro, go
  416.                                         * mark non-macro lines
  417.     EndPara                             *ELSE para is not a macro and
  418.                                         * go to end of para
  419.     Jump SHIFT:                         * Go shift it
  420.  HAS_MACROB:                            *
  421.     CursorUp MarkLine                   * Move up one line off macro
  422.                                         * and mark all non-macro lines
  423.  SHIFT:
  424.     ShiftRight ShiftRight               * Shift block right
  425.     BegLine                             * Move cursor to column 1
  426.     GotoBlockBeg                        * Move to 1st char of first line
  427.     MarkColumn                          * Mark 1st character column
  428.     PrevPosition                        * Return to last line
  429.     BegLine                             * Needed for single-line blocks
  430.     FillBlock '*' Return                * Fill 1st column with '*'
  431.     UnMarkBlock                         * Unmark non-macro block
  432.     EndPara NextPara                    * Move to para after macro
  433.     Jtrue START:                        *ELSE at eof
  434.     UnMarkBlock                         * Unmark last non-macro block
  435.     BegFile DelLine                     * Go to tof, delete temp line
  436. *
  437. * 55 bytes Wed  03-27-1991  08:26:36 (TH @F1)
  438.  
  439. * 
  440. * ----------------------------------------------
  441. * @(5) un-comment non-macro portion of file
  442. * ----------------------------------------------
  443. *
  444. @5  MacroBegin
  445.     Begfile InsertLine                  *
  446.  START:                                 *
  447.     MarkLine                            *
  448.     Find " " "macrob" Return "I" Return * Find start of macro
  449.     Jtrue HAS_MACROB:                   * If this para is a macro, go
  450.                                         * mark non-macro lines
  451.     EndPara                             *ELSE para is not a macro and
  452.                                         * go to end of para
  453.     Jump SHIFT:                         * Go shift it
  454.  HAS_MACROB:                            *
  455.     CursorUp MarkLine                   * Move up one line off macro
  456.                                         * and mark all non-macro lines
  457.  SHIFT:
  458.     ShiftLeft ShiftLeft                 * Shift block left, rem. cmnts.
  459.     UnMarkBlock                         * Unmark non-macro block
  460.     EndPara NextPara                    * Move to para after macro
  461.     Jtrue START:                        *ELSE at eof
  462.     UnMarkBlock                         * Unmark last non-macro block
  463.     BegFile DelLine                     * Go to tof, delete temp line
  464. *
  465. * 46 bytes Wed  03-27-1991  08:26:56
  466.  
  467. * 
  468. * ----------------------------------------------------------------------
  469. * @(F2)  Comment paragraph or block
  470. * ----------------------------------------------------------------------
  471. *
  472. * @F2 Places an asterisk and space in front of block that IS a
  473. * paragraph and also in front of any paragraph that is NOT marked
  474. * as a block from the cursor to the end of the paragraph.
  475. *
  476. * To run, first either mark a paragraph as a block or position the
  477. * cursor in column 1. Press Alt and F2 at the same time, and an asterisk
  478. * and a space are placed in column 1 in front of the block, or the
  479. * paragraph, from the cursor to the end of the paragraph.  Remember, a
  480. * paragraph ends at the next blank line. Insert must ON.
  481. *
  482. @F2 Macrobegin
  483.         Gotoblockbeg                    * Go to block begin
  484.  NEXT:                                  *
  485.         Endline Begline                 * End if line blank
  486.  Jfalse END:                            * If line blank, go to end
  487.         "* "                            * Put asterisk space in col 1
  488.         Cursordown                      * Move down to next line
  489.  Jump  NEXT:                            * Cycle until done
  490.  END:                                   *
  491. *
  492. * 18 bytes Mon  08-20-1990  22:19:35
  493.  
  494. * 
  495. * ----------------------------------------------
  496. * @(F3) Comment whole file
  497. * ----------------------------------------------
  498. *
  499. @F3     MacroBegin                  *
  500.             UnmarkBlock             * Unmark
  501.             Begfile MarkLine        * Mark bof
  502.             EndFile MarkLine        * Mark eof
  503.             ShiftRight ShiftRight   * Shift all lines to right
  504.             BegLine                 * Move cursor to col 1
  505.             UnmarkBlock             * Unmark
  506.             MarkColumn              * Mark 1st character column
  507.             BegFile
  508.             FillBlock '*' Return    * Fill 1st column with '*'
  509.             UnmarkBlock
  510. *
  511. * 20 bytes Tue  03-26-1991  14:57:37
  512.  
  513. * 
  514. * ----------------------------------------------
  515. * ^(F3_) un-comment whole file
  516. * ----------------------------------------------
  517. *
  518. ^F3         MacroBegin
  519.             UnmarkBlock             * Unmark
  520.             EndFile MarkLine        * Mark eof
  521.             Begfile MarkLine        * Mark bof
  522.             ShiftLeft ShiftLeft     * Remove comments in column 1 and 2
  523.             UnmarkBlock             * Unmark
  524. *
  525. * 12 bytes Tue  03-26-1991  14:57:43
  526.  
  527. * ======================================================================
  528. * Date: 03-28-91 (12:29)           Number: 3716     SemWare Support BBS
  529. *   To: BOB DEHNHARDT              Refer#: 3715
  530. * From: RICHARD BLACKBURN            Read: YES
  531. * Subj: Macro Help!                  Conf: (21) ILink
  532. * ----------------------------------------------------------------------
  533. *
  534. *        ╒══>Quoting BOB from Date: 03-26-91 (10:36)
  535. *        │
  536. *        │1. Center the text I just typed in
  537. *        │2. Go to the beginning of  the line, turn insert
  538. *        │off, and type a slash "/"
  539. *        │3. Type astericks (asterixes? stars.) up to one
  540. *        │space before my centered
  541. *        │4. Jump to one space after the centered text, and
  542. *        │continue entering stars until column 78
  543. *        │5. Go to the beginning of the next line, with insert
  544. *        │turned back on
  545. *        ╘══════════════════════════════════════════════════
  546. *
  547. * 
  548. * ----------------------------------------------------------------------
  549. * #(F3__) Center c program comment, Richard Blackburn, author
  550. * ----------------------------------------------------------------------
  551.  
  552. * Here is a macro that will center a line and put "*'s" around your text.
  553. * It will not change your Insert status.
  554. *
  555. #f3     MacroBegin                   ** Start Macro (key ^1)
  556.             UnMarkBlock              *  make sure no blocks marked
  557.             BegLine                  *  goto start of line
  558.             DropAnchor               *  ---
  559.             DropAnchor               *  --- to save our place
  560.             CenterLine               *  center the line
  561.             GotoBlockBeg             *  goto begin of block
  562.             UnMarkBlock              *  un mark it
  563.             CursorLeft               *  cursor left twice
  564.             CursorLeft               *
  565.             JFalse end               *  if not goto end line to long
  566.             MarkColumn               *  mark column
  567.             BegLine                  *  goto beginning of line
  568.             DelCh                    *  delete char incase in insert mode
  569.             "/"                      *  put a / at start
  570.             MarkColumn               *  mark the column
  571.             FillBlock "*" Return     *  fill with *
  572.             Copy                     *  copy to scrap buffer
  573.             EndLine                  *  goto end of line
  574.             CursorRight              *  space over one
  575.             Paste                    *  paste the * in here also
  576.             UnMarkBlock              *  un mark the block
  577.     end:    BegLine                  *  goto start of line
  578.             AddLine                  *  and add a line
  579. *
  580. * 33 bytes Fri  03-29-1991  07:43:59 (added TH)
  581. *
  582. * This will do this
  583. *
  584. * /************************* This will do this *************************
  585.  
  586. * Leaving the cursor at the start of the next line.
  587.  
  588. * Richard Blackburn
  589. * SemWare Technical Support
  590. * Written Thu  03-28-1991  at 12:22:39
  591.  
  592. * 
  593. * ----------------------------------------------------------------------
  594. * @(F5)  ORIGINAL commenting macro by John Goodman
  595. * ----------------------------------------------------------------------
  596. *
  597. @F5 MacroBegin
  598. * ------- Check and finish marking line or block if not marked -------*
  599.         CursorRight           * Needed for single-line blocks
  600.         GotoBlockBeg          * Try going to block beg, retain pos.
  601.    JTrue BLK:                 * Determine if a completed block
  602.         DropAnchor            * If not, DropAnchor will finish it
  603.                               * or mark current line if none started
  604.         GotoBlockBeg          * Go to block beg to retain position
  605.    BLK: GotoBlockEnd          * Start at the end
  606.         MarkLine              * Mark first line
  607.         PrevPosition          * Return to beg of where block was
  608. * -------------------------- comment block --------------------------*
  609.  COMMENT:
  610.         ShiftRight ShiftRight * Shift all lines to right
  611.         BegLine               * Move cursor to column 1
  612.         GotoBlockEnd          * Move to 1st char of last line
  613.         MarkColumn            * Mark 1st character column
  614.         PrevPosition          * Return to first line
  615.         BegLine               * Needed for single-line blocks
  616.         FillBlock '*' Return  * Fill 1st column with '*'
  617.         UnmarkBlock           * Unmark the block
  618.         CursorDown            * Go to next line
  619. *
  620. * 27 bytes Thu  04-18-1991  22:56:02
  621.  
  622. * 
  623. * ----------------------------------------------------------------------
  624. * ^(F5_) ORIGINAL un-commenting macro by John Goodman
  625. * ----------------------------------------------------------------------
  626. * un-comments even if *not commented
  627.  
  628. ^F5 MacroBegin
  629. * ------- Check and finish marking line or block if not marked -------*
  630.         CursorRight           * Needed for single-line blocks
  631.         GotoBlockBeg          * Try going to block beg, retain pos.
  632.    JTrue BLK:                 * Determine if a completed block
  633.         DropAnchor            * If not, DropAnchor will finish it
  634.                               * or mark current line if none started
  635.         GotoBlockBeg          * Go to block beg to retain position
  636.    BLK: GotoBlockEnd          * Start at the end
  637.         MarkLine              * Mark first line
  638.         PrevPosition          * Return to beg of where block was
  639. * ------------------------ un-comment block --------------------------*
  640.  UNCOMMENT:
  641.         ShiftLeft ShiftLeft   * Shift all lines to right
  642.         UnmarkBlock           * Unmark the block
  643.         CursorDown            * Go to next line
  644. *
  645. * 18 bytes Thu  04-18-1991  23:23:21
  646.  
  647. * 
  648. * ------------------------------------------------------------------------
  649. * #(F5__) Revised original Goodman un-commenting, checks before un-commenting
  650. * ------------------------------------------------------------------------
  651. *
  652. #F5 MacroBegin
  653. * ------- Check and finish marking line or block if not marked -------*
  654.         CursorRight           * Needed for single-line blocks
  655.         GotoBlockBeg          * Try going to block beg, retain pos.
  656.    JTrue BLK:                 * Determine if a completed block
  657.         DropAnchor            * If not, DropAnchor will finish it
  658.                               * or mark current line if none started
  659.         GotoBlockBeg          * Go to block beg to retain position
  660.    BLK: GotoBlockEnd          * Start at the end
  661.         MarkLine              * Mark first line
  662.         PrevPosition          * Return to beg of where block was
  663. * ----------------- Check if block already commented -----------------*
  664.         BegLine               * Go to bol in case line block
  665.         CursorRight * CursorRight * Move to column 2
  666.         Find "*" Return       * See if line is already commented
  667.         "LB" Return           *(assumes all block commented or not)
  668.         Jfalse END:           * If no star, must comment
  669. * ---------------------------- un-comment ----------------------------*
  670.  UNCOMMENT:                   *ELSE
  671.         ShiftLeft ShiftLeft   * Line has star, un-comment block
  672.  END:                         *
  673.         UnmarkBlock           * Unmark the block
  674.         CursorDown            * Go to next line
  675. *
  676. * 32 bytes Thu  04-18-1991  23:18:47
  677.  
  678. * 
  679. * ----------------------------------------------------------------------
  680. * #(F2__) Builds a "comment box" for C programmers, Tim Farley, author
  681. * ----------------------------------------------------------------------
  682. *
  683. * =========================================================================
  684. * Date: 04-18-91 (10:02)           Number: 230          SemWare Support BBS
  685. *   To: TOM HOGSHEAD               Refer#: 229
  686. * From: TIM FARLEY                   Read: NO
  687. * Subj: COMMENTS ON @7               Conf: 3 Macros
  688. * ------------------------------------------------------------------------
  689. * TH>  Very clever using FillBlock to fill a column 1 column block with dummy
  690. * TH>  character #224 and then replacing #224 with user input text. In all
  691. * TH>  cases I could think of it works perfectly - can't stump it!
  692. *
  693. * Another neat trick I like to use FillBlock for, is to make
  694. * "boxes" of a single character.
  695. *
  696. * For instance, if you want to make a large box of asterisks, just
  697. * mark a column block of the appropriate size and shape, do:
  698. *
  699. *      FillBlock "*" Return
  700. *
  701. * Then do some appropriate cursor commands to move "in" one column
  702. * in each direction from the edges of the block, mark again, and
  703. * do:
  704. *
  705. *      FillBlock " " Return
  706. *
  707. * Voila!  A box of asterisks with space in the middle.
  708. *
  709. * With a few frills for "C", the complete macro looks like this:
  710. *
  711. *
  712. * Builds a "comment box" for C programmers.
  713. *
  714. * The box starts on the left at the current indent level, and
  715. * extends over to column 78 on the right.
  716. *
  717. * Assumes there is nothing to the right of the cursor on the current
  718. * line at start.  To handle that case, increase the number of SplitLines
  719. * in line 2 of the macro.
  720. *
  721. #F2     MacroBegin
  722.         "/*" SplitLine 8                  * start "C" comment
  723.         CursorDown CursorLeft             * go to upper left of box
  724.         UnmarkBlock MarkColumn            * start marking
  725.         GotoColumn "78" Return            * extend box
  726.         CursorDown 6
  727.         MarkColumn                        * close mark
  728.         FillBlock "*" Return              * and fill with *'s
  729.         CursorUp CursorLeft               * move in one on lower right
  730.         GotoBlockBeg PrevPosition         * remember old beginning
  731.         UnmarkBlock MarkColumn            * start marking new block
  732.         PrevPosition                      * back to beginning
  733.         CursorDown CursorRight            * move in one on upper left
  734.         MarkColumn                        * close mark
  735.         FillBlock " " Return              * and fill with spaces
  736.         UnmarkBlock
  737.         CursorDown 6 CursorLeft "*/"      * close "C" comment
  738.         CursorUp 5                        * and move to spot to start
  739.         CursorRight                       * typing inside the block
  740.  
  741. * --Tim Farley
  742.  
  743.  
  744.